<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://opennotes.ru/knowledge/vba-knowledge/avtomaticheskoe-kopirovanie-vlozhenij-iz-pisem-v-papku/"><span style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:600; text-decoration: underline; color:#0000ff;">Автоматическое копирование вложений из писем в папку</span></a><span style=" font-family:'DejaVu Sans'; font-size:11pt;">								</span></p>
<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt;">Для автоматического копирования вложений из приходящих в Outlook писем в указанную папку можно воспользоваться правилом, исполняющим ниже прописанный скрипт VBA. Скрипт также модифицирует имя файла в соответствии с датой создания письма. Вариант из примера работает корректно для писем с одним вложением. Для писем с несколькими вложениями нужно изменить код в месте формирования имени файла.</span></p>
<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="more-178"></a>В Outlook откройте окно VBA. Можно воспользоваться сочетанием Alt + F11.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Вставьте код, прописанный ниже, в раздел Modules. Слева найдите Modules. Если там нет раздела нет пункта Module, то создайте такой правым щелчком мыши по Modules. Или нажмите правой кнопкой по Modules, Insert -&gt; Module.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Скопируйте код в главное окно.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Закройте VBA IDE.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Создайте правило, вызывающее скрипт.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">В первом окне мастера создания нового правила выберите проверку входящих писем.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">В следующем окне выберите правила отбора писем.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">В третьем окне выберите «выполнить скрипт» (или «запустить скрипт»). Когда нажмете на подчеркнутое слов «скрипт», должен быть виден код, который был вставлен в консоль VBA.</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Нажмите «Завершить» и проверьте работу правила.</li></ol>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt;">Код:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p>
<table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="2" cellpadding="0">
<tr>
<td bgcolor="#eff0f1">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Public</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Sub</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> saveAttachtoDisk(itm </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.MailItem)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.Attachment</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> saveFolder </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#f660ab;">String</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">dateOfMailItem = Format(itm.ReceivedTime, </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;yyyy.mm.dd&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;">)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">saveFolder = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;C:\\Test&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolder, vbDirectory) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">     MkDir saveFolder</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Each</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">In</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> itm.Attachments</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Проверяем наличие файла с таким же именем</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">j = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot; &quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> i = 1 </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">To</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> 1000</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Not</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolder &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; j &amp; objAtt.FileName) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    j = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;_&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; i &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;_&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Else</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Exit</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> i</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Конец проверки</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">objAtt.SaveAsFile saveFolder &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; j &amp; objAtt.FileName</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Set</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#00c2ff;">Nothing</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Sub</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p></td></tr></table>
<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:600;">Решение проблем</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt;">Если часть созданного правила выполняется, но сам скрипт не срабатывает, то, возможно, дело в настройках безопасности Outlook 2010/2013/2016 (в Outlook 2007 и старше эта опция находится в Tools -&gt; Macro Security). Чтобы макрос сработал:</span></p>
<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Откройте вкладку «Файл» (File), выберите настройки (Outlook Options) -&gt; настройки безопасности (Trust Center).</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Нажмите на настройки центра безопасности (Trust Center Settings), затем на настройки макросов слева (Macro Settings)</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Выберите вариант уведомления обо всех макроса (Notifications for all macros) и нажмите OK. Это позволит выполнять макросы, но предварительно будет появляться сообщение об их запуске.</li></ol>
<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:600;">Обработка msg-вложений</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt;">Ниже пример кода, который сохраняет каждое вложение из письма в папку с названием, совпадающим с темой письма. Если вложенные файлы сами являются письмами (т.е. имеют расширение *.msg), то сохраняются только вложения из них в подпапку с названием таким же, как тема вложенного *.msg файла.<br />Чтобы код работал нужно включить Microsoft Scripting Runtime как описано в </span><a href="http://http://opennotes.ru/knowledge/vba-knowledge/otkryt-outlook-msg-soobshheniya-iz-papki-s-pomoshhyu-vba-i-soxranit-vlozhenie/"><span style=" font-family:'DejaVu Sans'; font-size:11pt; text-decoration: underline; color:#0000ff;">другой статье</span></a><span style=" font-family:'DejaVu Sans'; font-size:11pt;">.</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p>
<table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="2" cellpadding="0">
<tr>
<td bgcolor="#eff0f1">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Sub</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> saveAttachtoDisk(itm </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.MailItem)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.Attachment</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAttachments </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.Attachment</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> saveFolder </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#f660ab;">String</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> openMsg </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> MailItem</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">dateOfMailItem = Format(itm.ReceivedTime, </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;yyyy.mm.dd&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;">)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">saveFolder = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;C:\Test\&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolder, vbDirectory) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  MkDir saveFolder</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t = 1 </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">To</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Len(itm.Subject)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  s = Mid(itm.Subject, t, 1)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Not</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> LCase(s) </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Like</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;[?/\|*&lt;&gt;:]&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    sSubject = sSubject &amp; s</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Each</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">In</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> itm.Attachments</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">saveFolderFull = saveFolder &amp; sSubject</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolderFull, vbDirectory) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  MkDir saveFolderFull</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Проверяем наличие файла с таким же именем</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">j = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot; &quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> i = 1 </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">To</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> 1000</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Not</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; j &amp; objAtt.FileName) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    j = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;_&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; i &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;_&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Else</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Exit</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> i</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Конец проверки</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">objAtt.SaveAsFile saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; j &amp; objAtt.FileName</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Из msg файлов достаём вложения и удаляем</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> LCase(Right(objAtt.FileName, 4)) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;.msg&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Set</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> openMsg = Application.CreateItemFromTemplate(saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; j &amp; objAtt.FileName)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   sSubject2 = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t = 1 </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">To</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Len(openMsg.Subject)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    s = Mid(openMsg.Subject, t, 1)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Not</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> LCase(s) </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Like</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;[?/\|*&lt;&gt;:]&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">     sSubject2 = sSubject2 &amp; s</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; sSubject2, vbDirectory) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">     MkDir saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; sSubject2</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Сохраняем вложения из msg-файла</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Each</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAttachments </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">In</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> openMsg.Attachments</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">     objAttachments.SaveAsFile saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; sSubject2 &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; objAttachments.FileName</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">     </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  openMsg.</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Close</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> olDiscard</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  Kill saveFolderFull &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; dateOfMailItem &amp; j &amp; objAtt.FileName </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Удаляем файл msg-файла</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Set</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#00c2ff;">Nothing</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Sub</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p></td></tr></table>
<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:600;">Сохранение письма с вложениями на диск</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt;">Если нужно сохранить само письмо, а не только вложения, то код упрощается:</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p>
<table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" cellspacing="2" cellpadding="0">
<tr>
<td bgcolor="#eff0f1">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Public</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Sub</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> saveAttachtoDisk(itm </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.MailItem)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Public Sub saveAttachtoDisk()</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> objAtt </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Outlook.Attachment</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> saveFolder </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#f660ab;">String</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#f660ab;">Integer</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> s </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#f660ab;">String</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">Dim</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> sSubject </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#151b8d;">As</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#f660ab;">String</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Dim itm As Outlook.MailItem</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Set itm = Application.ActiveExplorer().Selection(1)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">saveFolder = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;C:\Test&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolder, vbDirectory) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">     MkDir saveFolder</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Удаление недопустимых символов из темы</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t = 1 </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">To</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Len(itm.Subject)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  s = Mid(itm.Subject, t, 1)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Not</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> LCase(s) </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Like</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;[?/\|*&lt;&gt;:]&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    sSubject = sSubject &amp; s</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> t</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Проверяем наличие файла с таким же именем</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">j = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> i = 1 </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">To</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> 1000</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Not</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> Dir(saveFolder &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; j &amp; sSubject &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;.msg&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;">) = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Then</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    j = </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;(&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; i &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;)_&quot;</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Else</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">    </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Exit</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">For</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">   </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">If</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">  </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">Next</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> i</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Конец проверки</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#008000;">'Сохранение вложения</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;">itm.SaveAs (saveFolder &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;\&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> &amp; j &amp; sSubject &amp; </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; color:#800000;">&quot;.msg&quot;</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;">)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; background-color:#eff0f1;"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#eff0f1;"><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#8d38c9;">End</span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt;"> </span><span style=" font-family:'Courier New,Courier,sans-serif'; font-size:11pt; font-weight:600; color:#e56717;">Sub</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:11pt;"><br /></p></td></tr></table>
<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:600;">Полезные ссылки</span></p>
<ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://www.pixelchef.net/content/rule-autosave-attachment-outlook"><span style=" text-decoration: underline; color:#0000ff;">Rule to automatically save attachment in Outlook</span></a> — другой пример</li>
<li style=" font-family:'DejaVu Sans'; font-size:11pt;" style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://msdn.microsoft.com/en-us/library/office/ff861332.aspx"><span style=" text-decoration: underline; color:#0000ff;">MailItem Object (Outlook)</span></a></li></ol></body></html>